class Base():
    db = None
    table = ""
    column_name = ""
    new_name = ""
    query = ""
    attributes = {}

    def _clear_attributes(self):
        self.db = None
        self.table = ""
        self.column_name = ""
        self.new_name = ""
        self.query = ""
        self.attributes = {}

    def _trim_table(self, query):
        end = query.find(",")
        
        if end < 0:
            self.table = query.strip()
            return query.strip()

        self.table = query[:end].strip()
        return query[end + 1:].strip()

    def _trim_column_name(self, query):
        end = query.find(",")
        if end < 0:
            self.column_name = query.strip()
            return query.strip()
        
        self.column_name = query[:end].strip()
        return query[end + 1:].strip()

    def _trim_new_name(self, query):
        end = query.find(",")
        if end < 0:
            self.new_name = query.strip()
            return query.strip()
        else:
            self.new_name = query[:end].strip()
        return query[end + 1:].strip()

    def _build_dictionary(self, query):
        elements = query.split(",")

        for element in elements:
            attribute = element.split(":")
            self.attributes[attribute[0].lower().strip()] = attribute[1].strip()